#ifndef SRRESAMPLE_H
#define SRRESAMPLE_H
#include "ffmpeg.h"

class SrResample
{
public:
    SrResample();
    virtual ~SrResample();

    // 输出参数和输入参数一致除了采样格式, 输出为S16, 会释放codecpar
    virtual bool Open(AVCodecParameters *codecpar, bool isClearPara);
    virtual void Close();

    // 返回重采样后大小, 不管成功与否都释放indata空间
    virtual int Resample(AVFrame *indata, unsigned char *data);

private:

    SwrContext *_audioSwrContent = NULL;

    int  out_saplerate = 44100;

};

#endif // SRRESAMPLE_H
